---
import {getBlogList} from "../../service/BlogService";
import PostItemLine from "../../components/PostItemLine.astro";
import BackendLayout from "../../layouts/BackendLayout.astro";
export const prerender = false
const {searchParams} = new URL(Astro.request.url);
const page = parseInt(searchParams.get('page') || '1')
const pageSize = 10;
const blogs = await getBlogList(page, pageSize)
---
<BackendLayout>
    <div>
        <table class="data-table border-collapse border-slate-400 w-full">
            <thead>
            <tr>
                <td>title</td>
                <td>summary</td>
                <td>author</td>
                <td>opt</td>
            </tr>
            </thead>
            <tbody>
            {blogs.map(blog =>
                    <PostItemLine blog={blog}/>)}
            </tbody>
        </table>

    </div>
</BackendLayout>
<style>
    .data-table td {
        @apply p-6
    }
</style>

